(0) Obligation:

The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(1, 1).


The TRS R consists of the following rules:

a__ca__f(g(c))
a__f(g(X)) → g(X)
mark(c) → a__c
mark(f(X)) → a__f(X)
mark(g(X)) → g(X)
a__cc
a__f(X) → f(X)

Rewrite Strategy: INNERMOST

(1) TrsToWeightedTrsProof (BOTH BOUNDS(ID, ID) transformation)

Transformed TRS to weighted TRS

(2) Obligation:

The Runtime Complexity (innermost) of the given CpxWeightedTrs could be proven to be BOUNDS(1, 1).


The TRS R consists of the following rules:

a__ca__f(g(c)) [1]
a__f(g(X)) → g(X) [1]
mark(c) → a__c [1]
mark(f(X)) → a__f(X) [1]
mark(g(X)) → g(X) [1]
a__cc [1]
a__f(X) → f(X) [1]

Rewrite Strategy: INNERMOST

(3) TypeInferenceProof (BOTH BOUNDS(ID, ID) transformation)

Infered types.

(4) Obligation:

Runtime Complexity Weighted TRS with Types.
The TRS R consists of the following rules:

a__ca__f(g(c)) [1]
a__f(g(X)) → g(X) [1]
mark(c) → a__c [1]
mark(f(X)) → a__f(X) [1]
mark(g(X)) → g(X) [1]
a__cc [1]
a__f(X) → f(X) [1]

The TRS has the following type information:
a__c :: c:g:f
a__f :: c:g:f → c:g:f
g :: c:g:f → c:g:f
c :: c:g:f
mark :: c:g:f → c:g:f
f :: c:g:f → c:g:f

Rewrite Strategy: INNERMOST

(5) CompletionProof (UPPER BOUND(ID) transformation)

The TRS is a completely defined constructor system, as every type has a constant constructor and the following rules were added:
none

And the following fresh constants: none

(6) Obligation:

Runtime Complexity Weighted TRS where all functions are completely defined. The underlying TRS is:

Runtime Complexity Weighted TRS with Types.
The TRS R consists of the following rules:

a__ca__f(g(c)) [1]
a__f(g(X)) → g(X) [1]
mark(c) → a__c [1]
mark(f(X)) → a__f(X) [1]
mark(g(X)) → g(X) [1]
a__cc [1]
a__f(X) → f(X) [1]

The TRS has the following type information:
a__c :: c:g:f
a__f :: c:g:f → c:g:f
g :: c:g:f → c:g:f
c :: c:g:f
mark :: c:g:f → c:g:f
f :: c:g:f → c:g:f

Rewrite Strategy: INNERMOST

(7) CpxTypedWeightedTrsToRntsProof (UPPER BOUND(ID) transformation)

Transformed the TRS into an over-approximating RNTS by (improved) Size Abstraction.
The constant constructors are abstracted as follows:

c => 0

(8) Obligation:

Complexity RNTS consisting of the following rules:

a__c -{ 1 }→ a__f(1 + 0) :|:
a__c -{ 1 }→ 0 :|:
a__f(z) -{ 1 }→ 1 + X :|: z = 1 + X, X >= 0
a__f(z) -{ 1 }→ 1 + X :|: X >= 0, z = X
mark(z) -{ 1 }→ a__f(X) :|: z = 1 + X, X >= 0
mark(z) -{ 1 }→ a__c :|: z = 0
mark(z) -{ 1 }→ 1 + X :|: z = 1 + X, X >= 0

Only complete derivations are relevant for the runtime complexity.

(9) CompleteCoflocoProof (EQUIVALENT transformation)

Transformed the RNTS (where only complete derivations are relevant) into cost relations for CoFloCo:

eq(start(V),0,[fun(Out)],[]).
eq(start(V),0,[fun1(V, Out)],[V >= 0]).
eq(start(V),0,[mark(V, Out)],[V >= 0]).
eq(fun(Out),1,[fun1(1 + 0, Ret)],[Out = Ret]).
eq(fun1(V, Out),1,[],[Out = 1 + X1,V = 1 + X1,X1 >= 0]).
eq(mark(V, Out),1,[fun(Ret1)],[Out = Ret1,V = 0]).
eq(mark(V, Out),1,[fun1(X2, Ret2)],[Out = Ret2,V = 1 + X2,X2 >= 0]).
eq(mark(V, Out),1,[],[Out = 1 + X3,V = 1 + X3,X3 >= 0]).
eq(fun(Out),1,[],[Out = 0]).
eq(fun1(V, Out),1,[],[Out = 1 + X4,X4 >= 0,V = X4]).
input_output_vars(fun(Out),[],[Out]).
input_output_vars(fun1(V,Out),[V],[Out]).
input_output_vars(mark(V,Out),[V],[Out]).

CoFloCo proof output:
Preprocessing Cost Relations
=====================================

#### Computed strongly connected components
0. non_recursive : [fun1/2]
1. non_recursive : [fun/1]
2. non_recursive : [mark/2]
3. non_recursive : [start/1]

#### Obtained direct recursion through partial evaluation
0. SCC is partially evaluated into fun1/2
1. SCC is partially evaluated into fun/1
2. SCC is partially evaluated into mark/2
3. SCC is partially evaluated into start/1

Control-Flow Refinement of Cost Relations
=====================================

### Specialization of cost equations fun1/2
* CE 7 is refined into CE [12]
* CE 8 is refined into CE [13]


### Cost equations --> "Loop" of fun1/2
* CEs [12] --> Loop 7
* CEs [13] --> Loop 8

### Ranking functions of CR fun1(V,Out)

#### Partial ranking functions of CR fun1(V,Out)


### Specialization of cost equations fun/1
* CE 5 is refined into CE [14,15]
* CE 6 is refined into CE [16]


### Cost equations --> "Loop" of fun/1
* CEs [14] --> Loop 9
* CEs [15] --> Loop 10
* CEs [16] --> Loop 11

### Ranking functions of CR fun(Out)

#### Partial ranking functions of CR fun(Out)


### Specialization of cost equations mark/2
* CE 10 is refined into CE [17,18]
* CE 11 is refined into CE [19]
* CE 9 is refined into CE [20,21,22]


### Cost equations --> "Loop" of mark/2
* CEs [17,19] --> Loop 12
* CEs [18] --> Loop 13
* CEs [22] --> Loop 14
* CEs [21] --> Loop 15
* CEs [20] --> Loop 16

### Ranking functions of CR mark(V,Out)

#### Partial ranking functions of CR mark(V,Out)


### Specialization of cost equations start/1
* CE 2 is refined into CE [23,24,25]
* CE 3 is refined into CE [26,27]
* CE 4 is refined into CE [28,29,30,31,32]


### Cost equations --> "Loop" of start/1
* CEs [23,24,25,26,27,28,29,30,31,32] --> Loop 17

### Ranking functions of CR start(V)

#### Partial ranking functions of CR start(V)


Computing Bounds
=====================================

#### Cost of chains of fun1(V,Out):
* Chain [8]: 1
with precondition: [V+1=Out,V>=0]

* Chain [7]: 1
with precondition: [V=Out,V>=1]


#### Cost of chains of fun(Out):
* Chain [11]: 1
with precondition: [Out=0]

* Chain [10]: 2
with precondition: [Out=1]

* Chain [9]: 2
with precondition: [Out=2]


#### Cost of chains of mark(V,Out):
* Chain [16]: 2
with precondition: [V=0,Out=0]

* Chain [15]: 3
with precondition: [V=0,Out=1]

* Chain [14]: 3
with precondition: [V=0,Out=2]

* Chain [13]: 2
with precondition: [V=Out+1,V>=2]

* Chain [12]: 2
with precondition: [V=Out,V>=1]


#### Cost of chains of start(V):
* Chain [17]: 3
with precondition: []


Closed-form bounds of start(V):
-------------------------------------
* Chain [17] with precondition: []
- Upper bound: 3
- Complexity: constant

### Maximum cost of start(V): 3
Asymptotic class: constant
* Total analysis performed in 50 ms.

(10) BOUNDS(1, 1)